package com.fisherman.test;

import com.fisherman.aop.MathCalculator;
import com.fisherman.config.MainConfigOfAop;
import com.fisherman.tx.TxConfig;
import com.fisherman.tx.UserService;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @User: fisherman
 * @Date: 2020/5/20 11:20
 */
public class IOCTest_tx {

    @Test
    public void test() {
        //1.创建ioc容器
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(TxConfig.class);

        UserService userService = applicationContext.getBean(UserService.class);

        userService.insertUser();
        //关闭容器
        applicationContext.close();
    }
}
